{% extends "site_base.html" %}
{% load i18n %}
{% load pagination_tags %}

{% block head_title %}{% trans "Welcome" %}{% endblock %}

{% block extra_head %}
    {{ block.super }}
    <link rel="stylesheet" href="{{ MEDIA_URL }}css/dashboard.css" />
    <script type="text/javascript" src="{{ MEDIA_URL }}/js/jquery.tablesorter.min.js"></script>
{% endblock %}

{% block jquery %}
    {{ block.super }}
    $("table.list-table").tablesorter(
        {
            headers:
                {
                    3: {sorter: false},
                    5: {sorter: false},
                }
        }
    );
{% endblock %}



{% block subnav %}
    {% if user.is_authenticated %}
    <h2>{% trans "Links" %}</h2>
    <ul class="action-links">
        <li><a href='{% url promos_billboard_calendar_now %}'>Calendar</a></li>
        
    </ul>
    {% else %}
    <h2>{% trans "Learn more" %}</h2>
    <ul class="action-links">
        <li><a href="http://news21.ning.com">Social</a></li>
        <li><a href="http://news21blog.org">Blog</a></li>
        <li><a href="http://code.google.com/p/django-newsroom/">Code</a></li>
    </ul>
    {% endif %}
{% endblock %}

{% block body %}

    {% if user.is_authenticated %}
    {% autopaginate object_list 10 %}
    <table cellspacing="0" cellpadding="0" class="list-table">
        <thead>
            <tr>
                <th>Submitter</th>
                <th>Campaign</th>
                <th>Headline</th>
                <th>Suggested date</th>
                <th>Published date</th>
                {% if user.is_staff %}<th>Action</th>{% endif %}
            </tr>
        </thead>
        <tbody>
            {% for object in object_list %}
            <tr class="{% cycle '' 'alt-row' %}">
                <td>{{ object.promo.submitter }}</td>
                <td>{{ object.title }}</a> </td>
                <td>{{object.headline}}</td>
                <td>
                    {% for date in object.promo.promodate_set.all %}
                        {{ date }}: {{ date.start_date }} - {{ date.end_date }}<br/>
                    {% endfor %}
                </td>
                <td>{{ object.start_date }}</td>
                {% if user.is_staff %}<td><a href="{% url promos_promo_billboard_edit promo_id=object.promo_id,billboard_id=object.id %}">Edit</a></td>{% endif %}
            </tr>
            {% endfor %}
        </tbody>
    </table>
    {% paginate %}
    {% else %}
        {% blocktrans %}
            <p><b>Pinax</b> is a <a href="http://djangoproject.com/">Django</a> project intended to provide a starting point for websites. By integrating numerous reusable Django apps to take care of the things that many sites have in common, it lets you focus on what makes your site different.</p>

            <p>This site is a very basic running example of Pinax with most of the features taken out.</p>

            <p>For more information about Pinax, see <a href="http://pinaxproject.com/">http://pinaxproject.com/</a>.
        {% endblocktrans %}

        {% url acct_signup as signup_url %}
        {% url acct_login as login_url %}
        <p>{% blocktrans %}You can <a href="{{ signup_url }}">Sign up</a> and <a href="{{ login_url }}">Log in</a> to try out the site.{% endblocktrans %}</p>

    {% endif %}

{% endblock %}
